Commit b92a5feabef233b33835f3b379e53ada8a72773b
Exists in
master
Merge branch 'master' into 'master'
mostrar cabecera como default See merge request modulos-npm/foca-crear-nota-pedido!36
Showing
2 changed files
Show diff stats
src/js/controller.js
1 | angular.module('focaCrearNotaPedido') .controller('notaPedidoCtrl', | 1 | angular.module('focaCrearNotaPedido') .controller('notaPedidoCtrl', |
2 | [ | 2 | [ |
3 | '$scope', '$uibModal', '$location', '$filter', 'crearNotaPedidoService', | 3 | '$scope', '$uibModal', '$location', '$filter', 'crearNotaPedidoService', |
4 | 'focaModalService', | 4 | 'focaModalService', |
5 | function( | 5 | function( |
6 | $scope, $uibModal, $location, $filter, crearNotaPedidoService, focaModalService | 6 | $scope, $uibModal, $location, $filter, crearNotaPedidoService, focaModalService |
7 | ) { | 7 | ) { |
8 | $scope.botonera = [ | 8 | $scope.botonera = [ |
9 | {texto: 'Vendedor', accion: function() {$scope.seleccionarVendedor();}}, | 9 | {texto: 'Vendedor', accion: function() {$scope.seleccionarVendedor();}}, |
10 | {texto: 'Cliente', accion: function() {$scope.seleccionarCliente();}}, | 10 | {texto: 'Cliente', accion: function() {$scope.seleccionarCliente();}}, |
11 | {texto: 'Proveedor', accion: function() {$scope.seleccionarProveedor();}}, | 11 | {texto: 'Proveedor', accion: function() {$scope.seleccionarProveedor();}}, |
12 | {texto: 'Moneda', accion: function() {$scope.abrirModalMoneda();}}, | 12 | {texto: 'Moneda', accion: function() {$scope.abrirModalMoneda();}}, |
13 | { | 13 | { |
14 | texto: 'Precios y condiciones', | 14 | texto: 'Precios y condiciones', |
15 | accion: function() {$scope.abrirModalListaPrecio();}}, | 15 | accion: function() {$scope.abrirModalListaPrecio();}}, |
16 | {texto: 'Flete', accion: function() {$scope.abrirModalFlete();}}, | 16 | {texto: 'Flete', accion: function() {$scope.abrirModalFlete();}}, |
17 | {texto: '', accion: function() {}}, | 17 | {texto: '', accion: function() {}}, |
18 | {texto: '', accion: function() {}} | 18 | {texto: '', accion: function() {}} |
19 | ]; | 19 | ]; |
20 | 20 | ||
21 | $scope.show = false; | 21 | $scope.show = false; |
22 | $scope.cargando = true; | 22 | $scope.cargando = true; |
23 | $scope.dateOptions = { | 23 | $scope.dateOptions = { |
24 | maxDate: new Date(), | 24 | maxDate: new Date(), |
25 | minDate: new Date(2010, 0, 1) | 25 | minDate: new Date(2010, 0, 1) |
26 | }; | 26 | }; |
27 | 27 | ||
28 | $scope.notaPedido = { | 28 | $scope.notaPedido = { |
29 | vendedor: {}, | 29 | vendedor: {}, |
30 | cliente: {}, | 30 | cliente: {}, |
31 | domicilio: {dom: ''}, | 31 | domicilio: {dom: ''}, |
32 | moneda: {detalle: ''} | 32 | moneda: {detalle: ''} |
33 | }; | 33 | }; |
34 | 34 | ||
35 | $scope.cabecera = []; | 35 | $scope.cabecera = []; |
36 | $scope.showCabecera = false; | 36 | $scope.showCabecera = true; |
37 | 37 | ||
38 | $scope.now = new Date(); | 38 | $scope.now = new Date(); |
39 | $scope.puntoVenta = Math.round(Math.random() * 10000); | 39 | $scope.puntoVenta = Math.round(Math.random() * 10000); |
40 | $scope.comprobante = Math.round(Math.random() * 1000000); | 40 | $scope.comprobante = Math.round(Math.random() * 1000000); |
41 | 41 | ||
42 | $scope.articulosTabla = []; | 42 | $scope.articulosTabla = []; |
43 | var idLista; | 43 | var idLista; |
44 | var notaPedidoTemp = crearNotaPedidoService.getNotaPedido(); | 44 | var notaPedidoTemp = crearNotaPedidoService.getNotaPedido(); |
45 | crearNotaPedidoService.getPrecioCondicion().then( | 45 | crearNotaPedidoService.getPrecioCondicion().then( |
46 | function(res) { | 46 | function(res) { |
47 | $scope.precioCondiciones = res.data; | 47 | $scope.precioCondiciones = res.data; |
48 | } | 48 | } |
49 | ); | 49 | ); |
50 | if (notaPedidoTemp !== undefined) { | 50 | if (notaPedidoTemp !== undefined) { |
51 | notaPedidoTemp.fechaCarga = new Date(notaPedidoTemp.fechaCarga); | 51 | notaPedidoTemp.fechaCarga = new Date(notaPedidoTemp.fechaCarga); |
52 | $scope.notaPedido = notaPedidoTemp; | 52 | $scope.notaPedido = notaPedidoTemp; |
53 | $scope.notaPedido.flete = ($scope.notaPedido.flete).toString(); | 53 | $scope.notaPedido.flete = ($scope.notaPedido.flete).toString(); |
54 | $scope.notaPedido.bomba = ($scope.notaPedido.bomba).toString(); | 54 | $scope.notaPedido.bomba = ($scope.notaPedido.bomba).toString(); |
55 | idLista = $scope.notaPedido.precioCondicion; | 55 | idLista = $scope.notaPedido.precioCondicion; |
56 | crearNotaPedidoService | 56 | crearNotaPedidoService |
57 | .getArticulosByIdNotaPedido($scope.notaPedido.id).then( | 57 | .getArticulosByIdNotaPedido($scope.notaPedido.id).then( |
58 | function(res) { | 58 | function(res) { |
59 | $scope.articulosTabla = res.data; | 59 | $scope.articulosTabla = res.data; |
60 | } | 60 | } |
61 | ); | 61 | ); |
62 | //TODO DOMICILIOS QUE SE CARGAN AL EDITAR NOTA DE PEDIDO | 62 | //TODO DOMICILIOS QUE SE CARGAN AL EDITAR NOTA DE PEDIDO |
63 | //(NO REQUERIDO EN ESTA VERSION) | 63 | //(NO REQUERIDO EN ESTA VERSION) |
64 | // crearNotaPedidoService.getDomiciliosByIdNotaPedido($scope.notaPedido.id).then( | 64 | // crearNotaPedidoService.getDomiciliosByIdNotaPedido($scope.notaPedido.id).then( |
65 | // function(res) { | 65 | // function(res) { |
66 | // $scope.notaPedido.domicilio = res.data; | 66 | // $scope.notaPedido.domicilio = res.data; |
67 | // } | 67 | // } |
68 | // ); | 68 | // ); |
69 | } else { | 69 | } else { |
70 | $scope.notaPedido.fechaCarga = new Date(); | 70 | $scope.notaPedido.fechaCarga = new Date(); |
71 | $scope.notaPedido.bomba = '0'; | 71 | $scope.notaPedido.bomba = '0'; |
72 | $scope.notaPedido.flete = '0'; | 72 | $scope.notaPedido.flete = '0'; |
73 | idLista = undefined; | 73 | idLista = undefined; |
74 | } | 74 | } |
75 | //TO DO - FUNCIONES PARA MULTIPLES DOMICILIOS NO IMPLEMENTADAS EN ESTA DEMO | 75 | //TO DO - FUNCIONES PARA MULTIPLES DOMICILIOS NO IMPLEMENTADAS EN ESTA DEMO |
76 | // $scope.addNewDom = function() { | 76 | // $scope.addNewDom = function() { |
77 | // $scope.notaPedido.domicilio.push({ 'id': 0 }); | 77 | // $scope.notaPedido.domicilio.push({ 'id': 0 }); |
78 | // }; | 78 | // }; |
79 | // $scope.removeNewChoice = function(choice) { | 79 | // $scope.removeNewChoice = function(choice) { |
80 | // if ($scope.notaPedido.domicilio.length > 1) { | 80 | // if ($scope.notaPedido.domicilio.length > 1) { |
81 | // $scope.notaPedido.domicilio.splice($scope.notaPedido.domicilio.findIndex( | 81 | // $scope.notaPedido.domicilio.splice($scope.notaPedido.domicilio.findIndex( |
82 | // function(c) { | 82 | // function(c) { |
83 | // return c.$$hashKey === choice.$$hashKey; | 83 | // return c.$$hashKey === choice.$$hashKey; |
84 | // } | 84 | // } |
85 | // ), 1); | 85 | // ), 1); |
86 | // } | 86 | // } |
87 | // }; | 87 | // }; |
88 | $scope.crearNotaPedido = function() { | 88 | $scope.crearNotaPedido = function() { |
89 | if($scope.articulosTabla.length === 0) { | 89 | if($scope.articulosTabla.length === 0) { |
90 | focaModalService.alert('Debe cargar almenos un articulo'); | 90 | focaModalService.alert('Debe cargar almenos un articulo'); |
91 | return; | 91 | return; |
92 | } | 92 | } |
93 | if($scope.notaPedido.domicilio.id === undefined) { | 93 | if($scope.notaPedido.domicilio.id === undefined) { |
94 | $scope.notaPedido.domicilio.id = 0; | 94 | $scope.notaPedido.domicilio.id = 0; |
95 | } | 95 | } |
96 | var date = new Date(); | 96 | var date = new Date(); |
97 | var notaPedido = { | 97 | var notaPedido = { |
98 | id: 0, | 98 | id: 0, |
99 | fechaCarga: new Date(date.getTime() - (date.getTimezoneOffset() * 60000)) | 99 | fechaCarga: new Date(date.getTime() - (date.getTimezoneOffset() * 60000)) |
100 | .toISOString().slice(0, 19).replace('T', ' '), | 100 | .toISOString().slice(0, 19).replace('T', ' '), |
101 | vendedor: $scope.notaPedido.vendedor.nombre, | 101 | vendedor: $scope.notaPedido.vendedor.nombre, |
102 | idCliente: $scope.notaPedido.cliente.id, | 102 | idCliente: $scope.notaPedido.cliente.id, |
103 | domicilio: $scope.notaPedido.domicilio, | 103 | domicilio: $scope.notaPedido.domicilio, |
104 | precioCondicion: $scope.notaPedido.precioCondicion, | 104 | precioCondicion: $scope.notaPedido.precioCondicion, |
105 | bomba: $scope.notaPedido.bomba, | 105 | bomba: $scope.notaPedido.bomba, |
106 | flete: $scope.notaPedido.flete, | 106 | flete: $scope.notaPedido.flete, |
107 | total: $scope.getTotal() | 107 | total: $scope.getTotal() |
108 | }; | 108 | }; |
109 | crearNotaPedidoService.crearNotaPedido(notaPedido).then( | 109 | crearNotaPedidoService.crearNotaPedido(notaPedido).then( |
110 | function(data) { | 110 | function(data) { |
111 | focaModalService.alert('Nota pedido creada'); | 111 | focaModalService.alert('Nota pedido creada'); |
112 | if($scope.notaPedido.flete === 1) { | 112 | if($scope.notaPedido.flete === 1) { |
113 | var flete = { | 113 | var flete = { |
114 | idNotaPedido: data.data.id, | 114 | idNotaPedido: data.data.id, |
115 | idTransportista: $scope.notaPedido.fleteId, | 115 | idTransportista: $scope.notaPedido.fleteId, |
116 | idChofer: $scope.notaPedido.chofer.id, | 116 | idChofer: $scope.notaPedido.chofer.id, |
117 | idVehiculo: $scope.notaPedido.vehiculo.id, | 117 | idVehiculo: $scope.notaPedido.vehiculo.id, |
118 | kilometros: $scope.notaPedido.kilometros, | 118 | kilometros: $scope.notaPedido.kilometros, |
119 | costoKilometro: $scope.notaPedido.costoUnitarioKmFlete | 119 | costoKilometro: $scope.notaPedido.costoUnitarioKmFlete |
120 | }; | 120 | }; |
121 | crearNotaPedidoService.crearFlete(flete); | 121 | crearNotaPedidoService.crearFlete(flete); |
122 | } | 122 | } |
123 | var articulosNotaPedido = $scope.articulosTabla; | 123 | var articulosNotaPedido = $scope.articulosTabla; |
124 | for(var i = 0; i < articulosNotaPedido.length; i++) { | 124 | for(var i = 0; i < articulosNotaPedido.length; i++) { |
125 | delete articulosNotaPedido[i].edit; | 125 | delete articulosNotaPedido[i].edit; |
126 | articulosNotaPedido[i].idNotaPedido = data.data.id; | 126 | articulosNotaPedido[i].idNotaPedido = data.data.id; |
127 | crearNotaPedidoService | 127 | crearNotaPedidoService |
128 | .crearArticulosParaNotaPedido(articulosNotaPedido[i]); | 128 | .crearArticulosParaNotaPedido(articulosNotaPedido[i]); |
129 | } | 129 | } |
130 | $scope.limpiarPantalla(); | 130 | $scope.limpiarPantalla(); |
131 | } | 131 | } |
132 | ); | 132 | ); |
133 | }; | 133 | }; |
134 | 134 | ||
135 | $scope.seleccionarArticulo = function() { | 135 | $scope.seleccionarArticulo = function() { |
136 | if (idLista === undefined) { | 136 | if (idLista === undefined) { |
137 | focaModalService.alert( | 137 | focaModalService.alert( |
138 | 'Primero seleccione una lista de precio y condicion'); | 138 | 'Primero seleccione una lista de precio y condicion'); |
139 | return; | 139 | return; |
140 | } | 140 | } |
141 | var modalInstance = $uibModal.open( | 141 | var modalInstance = $uibModal.open( |
142 | { | 142 | { |
143 | ariaLabelledBy: 'Busqueda de Productos', | 143 | ariaLabelledBy: 'Busqueda de Productos', |
144 | templateUrl: 'modal-busqueda-productos.html', | 144 | templateUrl: 'modal-busqueda-productos.html', |
145 | controller: 'modalBusquedaProductosCtrl', | 145 | controller: 'modalBusquedaProductosCtrl', |
146 | resolve: { idLista: function() { return idLista; } }, | 146 | resolve: { idLista: function() { return idLista; } }, |
147 | size: 'lg' | 147 | size: 'lg' |
148 | } | 148 | } |
149 | ); | 149 | ); |
150 | modalInstance.result.then( | 150 | modalInstance.result.then( |
151 | function(producto) { | 151 | function(producto) { |
152 | var newArt = | 152 | var newArt = |
153 | { | 153 | { |
154 | id: 0, | 154 | id: 0, |
155 | codigo: producto.codigo, | 155 | codigo: producto.codigo, |
156 | sector: producto.sector, | 156 | sector: producto.sector, |
157 | sectorCodigo: producto.sector + '-' + producto.codigo, | 157 | sectorCodigo: producto.sector + '-' + producto.codigo, |
158 | descripcion: producto.descripcion, | 158 | descripcion: producto.descripcion, |
159 | item: $scope.articulosTabla.length + 1, | 159 | item: $scope.articulosTabla.length + 1, |
160 | nombre: producto.descripcion, | 160 | nombre: producto.descripcion, |
161 | precio: producto.precio.toFixed(2), | 161 | precio: producto.precio.toFixed(2), |
162 | costoUnitario: producto.costo, | 162 | costoUnitario: producto.costo, |
163 | edit: false | 163 | edit: false |
164 | }; | 164 | }; |
165 | $scope.articuloACargar = newArt; | 165 | $scope.articuloACargar = newArt; |
166 | $scope.cargando = false; | 166 | $scope.cargando = false; |
167 | }, function() { | 167 | }, function() { |
168 | // funcion ejecutada cuando se cancela el modal | 168 | // funcion ejecutada cuando se cancela el modal |
169 | } | 169 | } |
170 | ); | 170 | ); |
171 | }; | 171 | }; |
172 | 172 | ||
173 | $scope.seleccionarVendedor = function() { | 173 | $scope.seleccionarVendedor = function() { |
174 | var modalInstance = $uibModal.open( | 174 | var modalInstance = $uibModal.open( |
175 | { | 175 | { |
176 | ariaLabelledBy: 'Busqueda de Vendedores', | 176 | ariaLabelledBy: 'Busqueda de Vendedores', |
177 | templateUrl: 'modal-vendedores.html', | 177 | templateUrl: 'modal-vendedores.html', |
178 | controller: 'modalVendedoresCtrl', | 178 | controller: 'modalVendedoresCtrl', |
179 | size: 'lg' | 179 | size: 'lg' |
180 | } | 180 | } |
181 | ); | 181 | ); |
182 | modalInstance.result.then( | 182 | modalInstance.result.then( |
183 | function(vendedor) { | 183 | function(vendedor) { |
184 | addCabecera('Vendedor:', vendedor.NomVen); | 184 | addCabecera('Vendedor:', vendedor.NomVen); |
185 | $scope.notaPedido.vendedor.nombre = vendedor.NomVen; | 185 | $scope.notaPedido.vendedor.nombre = vendedor.NomVen; |
186 | }, function() { | 186 | }, function() { |
187 | 187 | ||
188 | } | 188 | } |
189 | ); | 189 | ); |
190 | }; | 190 | }; |
191 | 191 | ||
192 | $scope.seleccionarProveedor = function() { | 192 | $scope.seleccionarProveedor = function() { |
193 | var modalInstance = $uibModal.open( | 193 | var modalInstance = $uibModal.open( |
194 | { | 194 | { |
195 | ariaLabelledBy: 'Busqueda de Proveedor', | 195 | ariaLabelledBy: 'Busqueda de Proveedor', |
196 | templateUrl: 'modal-proveedor.html', | 196 | templateUrl: 'modal-proveedor.html', |
197 | controller: 'focaModalProveedorCtrl', | 197 | controller: 'focaModalProveedorCtrl', |
198 | size: 'lg' | 198 | size: 'lg' |
199 | } | 199 | } |
200 | ); | 200 | ); |
201 | modalInstance.result.then( | 201 | modalInstance.result.then( |
202 | function(proveedor) { | 202 | function(proveedor) { |
203 | $scope.notaPedido.proveedor = proveedor.NOM; | 203 | $scope.notaPedido.proveedor = proveedor.NOM; |
204 | addCabecera('Proveedor:', proveedor.NOM); | 204 | addCabecera('Proveedor:', proveedor.NOM); |
205 | }, function() { | 205 | }, function() { |
206 | 206 | ||
207 | } | 207 | } |
208 | ); | 208 | ); |
209 | }; | 209 | }; |
210 | 210 | ||
211 | $scope.seleccionarCliente = function() { | 211 | $scope.seleccionarCliente = function() { |
212 | var modalInstance = $uibModal.open( | 212 | var modalInstance = $uibModal.open( |
213 | { | 213 | { |
214 | ariaLabelledBy: 'Busqueda de Cliente', | 214 | ariaLabelledBy: 'Busqueda de Cliente', |
215 | templateUrl: 'foca-busqueda-cliente-modal.html', | 215 | templateUrl: 'foca-busqueda-cliente-modal.html', |
216 | controller: 'focaBusquedaClienteModalController', | 216 | controller: 'focaBusquedaClienteModalController', |
217 | size: 'lg' | 217 | size: 'lg' |
218 | } | 218 | } |
219 | ); | 219 | ); |
220 | modalInstance.result.then( | 220 | modalInstance.result.then( |
221 | function(cliente) { | 221 | function(cliente) { |
222 | $scope.notaPedido.cliente.nombre = cliente.nom; | 222 | $scope.notaPedido.cliente.nombre = cliente.nom; |
223 | $scope.notaPedido.cliente.id = cliente.cod; | 223 | $scope.notaPedido.cliente.id = cliente.cod; |
224 | crearNotaPedidoService.getDomiciliosByIdCliente(cliente.cod).then( | 224 | crearNotaPedidoService.getDomiciliosByIdCliente(cliente.cod).then( |
225 | function(data) { | 225 | function(data) { |
226 | if(data.data.length === 0){ | 226 | if(data.data.length === 0){ |
227 | focaModalService | 227 | focaModalService |
228 | .alert('El cliente no tienen domicilios de entrega') | 228 | .alert('El cliente no tienen domicilios de entrega') |
229 | .then( | 229 | .then( |
230 | function() { | 230 | function() { |
231 | $scope.seleccionarCliente(); | 231 | $scope.seleccionarCliente(); |
232 | $scope.notaPedido.cliente = {nombre: ''}; | 232 | $scope.notaPedido.cliente = {nombre: ''}; |
233 | } | 233 | } |
234 | ); | 234 | ); |
235 | return; | 235 | return; |
236 | } | 236 | } |
237 | var modalInstanceDomicilio = $uibModal.open( | 237 | var modalInstanceDomicilio = $uibModal.open( |
238 | { | 238 | { |
239 | ariaLabelledBy: 'Busqueda de Domicilios', | 239 | ariaLabelledBy: 'Busqueda de Domicilios', |
240 | templateUrl: 'modal-domicilio.html', | 240 | templateUrl: 'modal-domicilio.html', |
241 | controller: 'focaModalDomicilioController', | 241 | controller: 'focaModalDomicilioController', |
242 | resolve: { idCliente: function() { return cliente.cod; }}, | 242 | resolve: { idCliente: function() { return cliente.cod; }}, |
243 | size: 'lg', | 243 | size: 'lg', |
244 | backdrop: 'static', | 244 | backdrop: 'static', |
245 | } | 245 | } |
246 | ); | 246 | ); |
247 | modalInstanceDomicilio.result.then( | 247 | modalInstanceDomicilio.result.then( |
248 | function(domicilio) { | 248 | function(domicilio) { |
249 | focaModalService.alert('Domicilio elegido' + domicilio.dom); | 249 | focaModalService.alert('Domicilio elegido' + domicilio.dom); |
250 | }, function() { | 250 | }, function() { |
251 | $scope.notaPedido.cliente.nombre = ''; | 251 | $scope.notaPedido.cliente.nombre = ''; |
252 | $scope.notaPedido.cliente.id = ''; | 252 | $scope.notaPedido.cliente.id = ''; |
253 | removeCabecera('Cliente:'); | 253 | removeCabecera('Cliente:'); |
254 | $scope.seleccionarCliente(); | 254 | $scope.seleccionarCliente(); |
255 | return; | 255 | return; |
256 | } | 256 | } |
257 | ); | 257 | ); |
258 | } | 258 | } |
259 | ); | 259 | ); |
260 | addCabecera('Cliente:', cliente.nom); | 260 | addCabecera('Cliente:', cliente.nom); |
261 | }, function() { | 261 | }, function() { |
262 | 262 | ||
263 | } | 263 | } |
264 | ); | 264 | ); |
265 | }; | 265 | }; |
266 | 266 | ||
267 | $scope.mostrarFichaCliente = function() { | 267 | $scope.mostrarFichaCliente = function() { |
268 | $uibModal.open( | 268 | $uibModal.open( |
269 | { | 269 | { |
270 | ariaLabelledBy: 'Datos del Cliente', | 270 | ariaLabelledBy: 'Datos del Cliente', |
271 | templateUrl: 'foca-crear-nota-pedido-ficha-cliente.html', | 271 | templateUrl: 'foca-crear-nota-pedido-ficha-cliente.html', |
272 | controller: 'focaCrearNotaPedidoFichaClienteController', | 272 | controller: 'focaCrearNotaPedidoFichaClienteController', |
273 | size: 'lg' | 273 | size: 'lg' |
274 | } | 274 | } |
275 | ); | 275 | ); |
276 | }; | 276 | }; |
277 | 277 | ||
278 | $scope.getTotal = function() { | 278 | $scope.getTotal = function() { |
279 | var total = 0; | 279 | var total = 0; |
280 | var arrayTempArticulos = $scope.articulosTabla; | 280 | var arrayTempArticulos = $scope.articulosTabla; |
281 | for (var i = 0; i < arrayTempArticulos.length; i++) { | 281 | for (var i = 0; i < arrayTempArticulos.length; i++) { |
282 | total += arrayTempArticulos[i].precio * arrayTempArticulos[i].cantidad; | 282 | total += arrayTempArticulos[i].precio * arrayTempArticulos[i].cantidad; |
283 | } | 283 | } |
284 | return total.toFixed(2); | 284 | return total.toFixed(2); |
285 | }; | 285 | }; |
286 | 286 | ||
287 | $scope.getSubTotal = function() { | 287 | $scope.getSubTotal = function() { |
288 | if($scope.articuloACargar) { | 288 | if($scope.articuloACargar) { |
289 | return $scope.articuloACargar.precio * $scope.articuloACargar.cantidad; | 289 | return $scope.articuloACargar.precio * $scope.articuloACargar.cantidad; |
290 | } | 290 | } |
291 | }; | 291 | }; |
292 | 292 | ||
293 | $scope.abrirModalListaPrecio = function() { | 293 | $scope.abrirModalListaPrecio = function() { |
294 | var modalInstance = $uibModal.open( | 294 | var modalInstance = $uibModal.open( |
295 | { | 295 | { |
296 | ariaLabelledBy: 'Busqueda de Precio Condición', | 296 | ariaLabelledBy: 'Busqueda de Precio Condición', |
297 | templateUrl: 'modal-precio-condicion.html', | 297 | templateUrl: 'modal-precio-condicion.html', |
298 | controller: 'focaModalPrecioCondicionController', | 298 | controller: 'focaModalPrecioCondicionController', |
299 | size: 'lg' | 299 | size: 'lg' |
300 | } | 300 | } |
301 | ); | 301 | ); |
302 | modalInstance.result.then( | 302 | modalInstance.result.then( |
303 | function(precioCondicion) { | 303 | function(precioCondicion) { |
304 | $scope.notaPedido.precioCondicion = precioCondicion.nombre; | 304 | $scope.notaPedido.precioCondicion = precioCondicion.nombre; |
305 | idLista = precioCondicion.idListaPrecio; | 305 | idLista = precioCondicion.idListaPrecio; |
306 | $scope.articulosTabla = []; | 306 | $scope.articulosTabla = []; |
307 | 307 | ||
308 | addCabecera('Precios y condiciones:', precioCondicion.nombre); | 308 | addCabecera('Precios y condiciones:', precioCondicion.nombre); |
309 | }, function() { | 309 | }, function() { |
310 | 310 | ||
311 | } | 311 | } |
312 | ); | 312 | ); |
313 | }; | 313 | }; |
314 | 314 | ||
315 | $scope.abrirModalFlete = function() { | 315 | $scope.abrirModalFlete = function() { |
316 | var modalInstance = $uibModal.open( | 316 | var modalInstance = $uibModal.open( |
317 | { | 317 | { |
318 | ariaLabelledBy: 'Busqueda de Flete', | 318 | ariaLabelledBy: 'Busqueda de Flete', |
319 | templateUrl: 'modal-flete.html', | 319 | templateUrl: 'modal-flete.html', |
320 | controller: 'focaModalFleteController', | 320 | controller: 'focaModalFleteController', |
321 | size: 'lg', | 321 | size: 'lg', |
322 | resolve: { | 322 | resolve: { |
323 | parametrosFlete: | 323 | parametrosFlete: |
324 | function() { | 324 | function() { |
325 | return { | 325 | return { |
326 | flete: $scope.notaPedido.flete, | 326 | flete: $scope.notaPedido.flete, |
327 | bomba: $scope.notaPedido.bomba, | 327 | bomba: $scope.notaPedido.bomba, |
328 | kilometros: $scope.notaPedido.kilometros | 328 | kilometros: $scope.notaPedido.kilometros |
329 | }; | 329 | }; |
330 | } | 330 | } |
331 | } | 331 | } |
332 | } | 332 | } |
333 | ); | 333 | ); |
334 | modalInstance.result.then( | 334 | modalInstance.result.then( |
335 | function(datos) { | 335 | function(datos) { |
336 | $scope.notaPedido.flete = datos.flete; | 336 | $scope.notaPedido.flete = datos.flete; |
337 | $scope.notaPedido.bomba = datos.bomba; | 337 | $scope.notaPedido.bomba = datos.bomba; |
338 | $scope.notaPedido.kilometros = datos.kilometros; | 338 | $scope.notaPedido.kilometros = datos.kilometros; |
339 | 339 | ||
340 | addCabecera('Flete:', datos.flete); | 340 | addCabecera('Flete:', datos.flete); |
341 | if(datos.flete === 'si') { | 341 | if(datos.flete === 'si') { |
342 | addCabecera('Bomba:', datos.bomba); | 342 | addCabecera('Bomba:', datos.bomba); |
343 | addCabecera('Kilometros:', datos.kilometros); | 343 | addCabecera('Kilometros:', datos.kilometros); |
344 | } else { | 344 | } else { |
345 | removeCabecera('Bomba:'); | 345 | removeCabecera('Bomba:'); |
346 | removeCabecera('Kilometros:'); | 346 | removeCabecera('Kilometros:'); |
347 | } | 347 | } |
348 | }, function() { | 348 | }, function() { |
349 | 349 | ||
350 | } | 350 | } |
351 | ); | 351 | ); |
352 | }; | 352 | }; |
353 | 353 | ||
354 | $scope.abrirModalMoneda = function() { | 354 | $scope.abrirModalMoneda = function() { |
355 | var modalInstance = $uibModal.open( | 355 | var modalInstance = $uibModal.open( |
356 | { | 356 | { |
357 | ariaLabelledBy: 'Busqueda de Moneda', | 357 | ariaLabelledBy: 'Busqueda de Moneda', |
358 | templateUrl: 'modal-moneda.html', | 358 | templateUrl: 'modal-moneda.html', |
359 | controller: 'focaModalMonedaController', | 359 | controller: 'focaModalMonedaController', |
360 | size: 'lg' | 360 | size: 'lg' |
361 | } | 361 | } |
362 | ); | 362 | ); |
363 | modalInstance.result.then( | 363 | modalInstance.result.then( |
364 | function(moneda) { | 364 | function(moneda) { |
365 | $scope.notaPedido.moneda = { | 365 | $scope.notaPedido.moneda = { |
366 | id: moneda.ID, | 366 | id: moneda.ID, |
367 | detalle: moneda.DETALLE, | 367 | detalle: moneda.DETALLE, |
368 | simbolo: moneda.SIMBOLO | 368 | simbolo: moneda.SIMBOLO |
369 | }; | 369 | }; |
370 | 370 | ||
371 | addCabecera('Moneda:', moneda.DETALLE); | 371 | addCabecera('Moneda:', moneda.DETALLE); |
372 | }, function() { | 372 | }, function() { |
373 | 373 | ||
374 | } | 374 | } |
375 | ); | 375 | ); |
376 | }; | 376 | }; |
377 | 377 | ||
378 | $scope.agregarATabla = function(key) { | 378 | $scope.agregarATabla = function(key) { |
379 | if(key === 13) { | 379 | if(key === 13) { |
380 | if($scope.articuloACargar.cantidad === undefined || | 380 | if($scope.articuloACargar.cantidad === undefined || |
381 | $scope.articuloACargar.cantidad === 0 || | 381 | $scope.articuloACargar.cantidad === 0 || |
382 | $scope.articuloACargar.cantidad === null ){ | 382 | $scope.articuloACargar.cantidad === null ){ |
383 | focaModalService.alert('El valor debe ser al menos 1'); | 383 | focaModalService.alert('El valor debe ser al menos 1'); |
384 | return; | 384 | return; |
385 | } | 385 | } |
386 | delete $scope.articuloACargar.sectorCodigo; | 386 | delete $scope.articuloACargar.sectorCodigo; |
387 | $scope.articulosTabla.push($scope.articuloACargar); | 387 | $scope.articulosTabla.push($scope.articuloACargar); |
388 | $scope.cargando = true; | 388 | $scope.cargando = true; |
389 | } | 389 | } |
390 | }; | 390 | }; |
391 | 391 | ||
392 | $scope.quitarArticulo = function(key) { | 392 | $scope.quitarArticulo = function(key) { |
393 | $scope.articulosTabla.splice(key, 1); | 393 | $scope.articulosTabla.splice(key, 1); |
394 | }; | 394 | }; |
395 | 395 | ||
396 | $scope.editarArticulo = function(key, articulo) { | 396 | $scope.editarArticulo = function(key, articulo) { |
397 | if(key === 13) { | 397 | if(key === 13) { |
398 | if(articulo.cantidad === null || articulo.cantidad === 0 || | 398 | if(articulo.cantidad === null || articulo.cantidad === 0 || |
399 | articulo.cantidad === undefined){ | 399 | articulo.cantidad === undefined){ |
400 | focaModalService.alert('El valor debe ser al menos 1'); | 400 | focaModalService.alert('El valor debe ser al menos 1'); |
401 | return; | 401 | return; |
402 | } | 402 | } |
403 | articulo.edit = false; | 403 | articulo.edit = false; |
404 | } | 404 | } |
405 | }; | 405 | }; |
406 | 406 | ||
407 | $scope.cambioEdit = function(articulo) { | 407 | $scope.cambioEdit = function(articulo) { |
408 | articulo.edit = true; | 408 | articulo.edit = true; |
409 | }; | 409 | }; |
410 | 410 | ||
411 | $scope.limpiarFlete = function() { | 411 | $scope.limpiarFlete = function() { |
412 | $scope.notaPedido.fleteNombre = ''; | 412 | $scope.notaPedido.fleteNombre = ''; |
413 | $scope.notaPedido.chofer = ''; | 413 | $scope.notaPedido.chofer = ''; |
414 | $scope.notaPedido.vehiculo = ''; | 414 | $scope.notaPedido.vehiculo = ''; |
415 | $scope.notaPedido.kilometros = ''; | 415 | $scope.notaPedido.kilometros = ''; |
416 | $scope.notaPedido.costoUnitarioKmFlete = ''; | 416 | $scope.notaPedido.costoUnitarioKmFlete = ''; |
417 | $scope.choferes = ''; | 417 | $scope.choferes = ''; |
418 | $scope.vehiculos = ''; | 418 | $scope.vehiculos = ''; |
419 | }; | 419 | }; |
420 | 420 | ||
421 | $scope.limpiarPantalla = function() { | 421 | $scope.limpiarPantalla = function() { |
422 | $scope.limpiarFlete(); | 422 | $scope.limpiarFlete(); |
423 | $scope.notaPedido.flete = '0'; | 423 | $scope.notaPedido.flete = '0'; |
424 | $scope.notaPedido.bomba = '0'; | 424 | $scope.notaPedido.bomba = '0'; |
425 | $scope.notaPedido.precioCondicion = ''; | 425 | $scope.notaPedido.precioCondicion = ''; |
426 | $scope.articulosTabla = []; | 426 | $scope.articulosTabla = []; |
427 | $scope.notaPedido.vendedor.nombre = ''; | 427 | $scope.notaPedido.vendedor.nombre = ''; |
428 | $scope.notaPedido.cliente = {nombre: ''}; | 428 | $scope.notaPedido.cliente = {nombre: ''}; |
429 | $scope.notaPedido.domicilio = {dom: ''}; | 429 | $scope.notaPedido.domicilio = {dom: ''}; |
430 | $scope.domiciliosCliente = []; | 430 | $scope.domiciliosCliente = []; |
431 | }; | 431 | }; |
432 | 432 | ||
433 | $scope.resetFilter = function() { | 433 | $scope.resetFilter = function() { |
434 | $scope.articuloACargar = {}; | 434 | $scope.articuloACargar = {}; |
435 | $scope.cargando = true; | 435 | $scope.cargando = true; |
436 | }; | 436 | }; |
437 | 437 | ||
438 | $scope.selectFocus = function($event) { | 438 | $scope.selectFocus = function($event) { |
439 | $event.target.select(); | 439 | $event.target.select(); |
440 | }; | 440 | }; |
441 | 441 | ||
442 | $scope.salir = function() { | 442 | $scope.salir = function() { |
443 | $location.path('/'); | 443 | $location.path('/'); |
444 | }; | 444 | }; |
445 | 445 | ||
446 | function addCabecera(label, valor) { | 446 | function addCabecera(label, valor) { |
447 | var propiedad = $filter('filter')($scope.cabecera, {label: label}); | 447 | var propiedad = $filter('filter')($scope.cabecera, {label: label}); |
448 | if(propiedad.length === 1) { | 448 | if(propiedad.length === 1) { |
449 | propiedad[0].valor = valor; | 449 | propiedad[0].valor = valor; |
450 | } else { | 450 | } else { |
451 | $scope.cabecera.push({label: label, valor: valor}); | 451 | $scope.cabecera.push({label: label, valor: valor}); |
452 | } | 452 | } |
453 | } | 453 | } |
454 | 454 | ||
455 | function removeCabecera(label) { | 455 | function removeCabecera(label) { |
456 | var propiedad = $filter('filter')($scope.cabecera, {label: label}); | 456 | var propiedad = $filter('filter')($scope.cabecera, {label: label}); |
457 | if(propiedad.length === 1){ | 457 | if(propiedad.length === 1){ |
458 | $scope.cabecera.splice($scope.cabecera.indexOf(propiedad[0]), 1); | 458 | $scope.cabecera.splice($scope.cabecera.indexOf(propiedad[0]), 1); |
459 | } | 459 | } |
460 | } | 460 | } |
461 | } | 461 | } |
462 | ] | 462 | ] |
463 | ) | 463 | ) |
464 | .controller('notaPedidoListaCtrl', [ | 464 | .controller('notaPedidoListaCtrl', [ |
465 | '$scope', | 465 | '$scope', |
466 | 'crearNotaPedidoService', | 466 | 'crearNotaPedidoService', |
467 | '$location', | 467 | '$location', |
468 | function($scope, crearNotaPedidoService, $location) { | 468 | function($scope, crearNotaPedidoService, $location) { |
469 | crearNotaPedidoService.obtenerNotaPedido().then(function(datos) { | 469 | crearNotaPedidoService.obtenerNotaPedido().then(function(datos) { |
470 | $scope.notaPedidos = datos.data; | 470 | $scope.notaPedidos = datos.data; |
471 | }); | 471 | }); |
472 | $scope.editar = function(notaPedido) { | 472 | $scope.editar = function(notaPedido) { |
473 | crearNotaPedidoService.setNotaPedido(notaPedido); | 473 | crearNotaPedidoService.setNotaPedido(notaPedido); |
474 | $location.path('/venta-nota-pedido/abm/'); | 474 | $location.path('/venta-nota-pedido/abm/'); |
475 | }; | 475 | }; |
476 | $scope.crearPedido = function() { | 476 | $scope.crearPedido = function() { |
477 | crearNotaPedidoService.clearNotaPedido(); | 477 | crearNotaPedidoService.clearNotaPedido(); |
478 | $location.path('/venta-nota-pedido/abm/'); | 478 | $location.path('/venta-nota-pedido/abm/'); |
479 | }; | 479 | }; |
480 | } | 480 | } |
481 | ]) | 481 | ]) |
482 | .controller('focaCrearNotaPedidoFichaClienteController', [ | 482 | .controller('focaCrearNotaPedidoFichaClienteController', [ |
483 | '$scope', | 483 | '$scope', |
484 | 'crearNotaPedidoService', | 484 | 'crearNotaPedidoService', |
485 | '$location', | 485 | '$location', |
486 | function($scope, crearNotaPedidoService, $location) { | 486 | function($scope, crearNotaPedidoService, $location) { |
487 | crearNotaPedidoService.obtenerNotaPedido().then(function(datos) { | 487 | crearNotaPedidoService.obtenerNotaPedido().then(function(datos) { |
488 | $scope.notaPedidos = datos.data; | 488 | $scope.notaPedidos = datos.data; |
489 | }); | 489 | }); |
490 | $scope.editar = function(notaPedido) { | 490 | $scope.editar = function(notaPedido) { |
491 | crearNotaPedidoService.setNotaPedido(notaPedido); | 491 | crearNotaPedidoService.setNotaPedido(notaPedido); |
492 | $location.path('/venta-nota-pedido/abm/'); | 492 | $location.path('/venta-nota-pedido/abm/'); |
493 | }; | 493 | }; |
494 | $scope.crearPedido = function() { | 494 | $scope.crearPedido = function() { |
495 | crearNotaPedidoService.clearNotaPedido(); | 495 | crearNotaPedidoService.clearNotaPedido(); |
496 | $location.path('/venta-nota-pedido/abm/'); | 496 | $location.path('/venta-nota-pedido/abm/'); |
497 | }; | 497 | }; |
498 | } | 498 | } |
499 | ]); | 499 | ]); |
500 | 500 |
src/views/nota-pedido.html
1 | <div class="crear-nota-pedido"> | 1 | <div class="crear-nota-pedido"> |
2 | <form name="formCrearNota" ng-submit="crearNotaPedido()"> | 2 | <form name="formCrearNota" ng-submit="crearNotaPedido()"> |
3 | <div class="row"> | 3 | <div class="row"> |
4 | <div class="col-md-10 offset-md-1 col-lg-8 offset-lg-2"> | 4 | <div class="col-md-10 offset-md-1 col-lg-8 offset-lg-2"> |
5 | <div class="row p-1 panel-informativo"> | 5 | <div class="row p-1 panel-informativo"> |
6 | <div class="col-12"> | 6 | <div class="col-12"> |
7 | <div class="row"> | 7 | <div class="row"> |
8 | <div class="col-12 col-sm-4 nota-pedido"> | 8 | <div class="col-12 col-sm-4 nota-pedido"> |
9 | <h5>NOTA DE PEDIDO</h5> | 9 | <h5>NOTA DE PEDIDO</h5> |
10 | </div> | 10 | </div> |
11 | <div class="col-6 col-sm-4 numero-pedido">Nº {{puntoVenta}}-{{comprobante}}</div> | 11 | <div class="col-6 col-sm-4 numero-pedido">Nº {{puntoVenta}}-{{comprobante}}</div> |
12 | <div class="col-6 col-sm-4 text-right"> | 12 | <div class="col-6 col-sm-4 text-right"> |
13 | Fecha: {{ now | date:'dd/MM/yyyy HH:mm'}} | 13 | Fecha: {{ now | date:'dd/MM/yyyy HH:mm'}} |
14 | </div> | 14 | </div> |
15 | </div> | 15 | </div> |
16 | <div class="row"> | 16 | <div class="row"> |
17 | <div class="col-auto" ng-repeat="cab in cabecera" ng-show="showCabecera"> | 17 | <div class="col-auto" ng-repeat="cab in cabecera" ng-show="showCabecera"> |
18 | <span class="label" ng-bind="cab.label"></span> | 18 | <span class="label" ng-bind="cab.label"></span> |
19 | <span class="valor" ng-bind="cab.valor"></span> | 19 | <span class="valor" ng-bind="cab.valor"></span> |
20 | </div> | 20 | </div> |
21 | <a | 21 | <a |
22 | class="btn col-12 btn-secondary d-sm-none" | 22 | class="btn col-12 btn-secondary d-sm-none" |
23 | ng-show="cabecera.length > 0" | 23 | ng-show="cabecera.length > 0" |
24 | ng-click="showCabecera = !showCabecera" | 24 | ng-click="showCabecera = !showCabecera" |
25 | > | 25 | > |
26 | <i | 26 | <i |
27 | class="fa fa-chevron-down" | 27 | class="fa fa-chevron-down" |
28 | ng-hide="showCabecera" | 28 | ng-hide="showCabecera" |
29 | aria-hidden="true" | 29 | aria-hidden="true" |
30 | > | 30 | > |
31 | </i> | 31 | </i> |
32 | <i | 32 | <i |
33 | class="fa fa-chevron-up" | 33 | class="fa fa-chevron-up" |
34 | ng-show="showCabecera" | 34 | ng-show="showCabecera" |
35 | aria-hidden="true"> | 35 | aria-hidden="true"> |
36 | </i> | 36 | </i> |
37 | </a> | 37 | </a> |
38 | </div> | 38 | </div> |
39 | </div> | 39 | </div> |
40 | </div> | 40 | </div> |
41 | <div class="row p-1 botonera-secundaria"> | 41 | <div class="row p-1 botonera-secundaria"> |
42 | <div class="col-12"> | 42 | <div class="col-12"> |
43 | <div class="row"> | 43 | <div class="row"> |
44 | <div class="col-6 col-sm-3 px-0 py-0" ng-repeat="boton in botonera"> | 44 | <div class="col-6 col-sm-3 px-0 py-0" ng-repeat="boton in botonera"> |
45 | <button | 45 | <button |
46 | type="button" | 46 | type="button" |
47 | class="btn btn-default btn-block btn-xs text-left py-2" | 47 | class="btn btn-default btn-block btn-xs text-left py-2" |
48 | ng-click="boton.accion()" | 48 | ng-click="boton.accion()" |
49 | ng-class="{'d-none d-sm-block': boton.texto == ''}" | 49 | ng-class="{'d-none d-sm-block': boton.texto == ''}" |
50 | > | 50 | > |
51 | <i | 51 | <i |
52 | class="fa fa-arrow-circle-right" | 52 | class="fa fa-arrow-circle-right" |
53 | ng-show="boton.texto != ''" | 53 | ng-show="boton.texto != ''" |
54 | ></i> | 54 | ></i> |
55 | | 55 | |
56 | {{boton.texto}} | 56 | {{boton.texto}} |
57 | </button> | 57 | </button> |
58 | </div> | 58 | </div> |
59 | </div> | 59 | </div> |
60 | </div> | 60 | </div> |
61 | </div> | 61 | </div> |
62 | </div> | 62 | </div> |
63 | </div> | 63 | </div> |
64 | </form> | 64 | </form> |
65 | <div class="row"> | 65 | <div class="row"> |
66 | <div class="col-12 col-md-10 col-lg-8 offset-md-1 offset-lg-2"> | 66 | <div class="col-12 col-md-10 col-lg-8 offset-md-1 offset-lg-2"> |
67 | <!-- PC --> | 67 | <!-- PC --> |
68 | <div class="row grilla-articulo align-items-end"> | 68 | <div class="row grilla-articulo align-items-end"> |
69 | <table class="table tabla-articulo table-striped table-sm table-dark"> | 69 | <table class="table tabla-articulo table-striped table-sm table-dark"> |
70 | <thead> | 70 | <thead> |
71 | <tr class="d-flex"> | 71 | <tr class="d-flex"> |
72 | <th class="">#</th> | 72 | <th class="">#</th> |
73 | <th class="col">Código</th> | 73 | <th class="col">Código</th> |
74 | <th class="col-4">Descripción</th> | 74 | <th class="col-4">Descripción</th> |
75 | <th class="col text-right">Cantidad</th> | 75 | <th class="col text-right">Cantidad</th> |
76 | <th class="col text-right">Precio Unitario</th> | 76 | <th class="col text-right">Precio Unitario</th> |
77 | <th class="col text-right">SubTotal</th> | 77 | <th class="col text-right">SubTotal</th> |
78 | <th class="text-right"> | 78 | <th class="text-right"> |
79 | <button | 79 | <button |
80 | class="btn btn-outline-secondary selectable" | 80 | class="btn btn-outline-secondary selectable" |
81 | ng-click="show = !show; masMenos()" | 81 | ng-click="show = !show; masMenos()" |
82 | > | 82 | > |
83 | <i | 83 | <i |
84 | class="fa fa-chevron-down" | 84 | class="fa fa-chevron-down" |
85 | ng-show="show" | 85 | ng-show="show" |
86 | aria-hidden="true" | 86 | aria-hidden="true" |
87 | > | 87 | > |
88 | </i> | 88 | </i> |
89 | <i | 89 | <i |
90 | class="fa fa-chevron-up" | 90 | class="fa fa-chevron-up" |
91 | ng-hide="show" | 91 | ng-hide="show" |
92 | aria-hidden="true"> | 92 | aria-hidden="true"> |
93 | </i> | 93 | </i> |
94 | </button> | 94 | </button> |
95 | </th> | 95 | </th> |
96 | </tr> | 96 | </tr> |
97 | </thead> | 97 | </thead> |
98 | <tbody class="tabla-articulo-body"> | 98 | <tbody class="tabla-articulo-body"> |
99 | <tr | 99 | <tr |
100 | ng-repeat="(key, articulo) in articulosTabla" | 100 | ng-repeat="(key, articulo) in articulosTabla" |
101 | ng-show="show || key == (articulosTabla.length - 1)" | 101 | ng-show="show || key == (articulosTabla.length - 1)" |
102 | class="d-flex" | 102 | class="d-flex" |
103 | > | 103 | > |
104 | <td ng-bind="key + 1"></td> | 104 | <td ng-bind="key + 1"></td> |
105 | <td | 105 | <td |
106 | class="col" | 106 | class="col" |
107 | ng-bind="articulo.sector + '-' + articulo.codigo" | 107 | ng-bind="articulo.sector + '-' + articulo.codigo" |
108 | ></td> | 108 | ></td> |
109 | <td | 109 | <td |
110 | class="col-4" | 110 | class="col-4" |
111 | ng-bind="articulo.descripcion" | 111 | ng-bind="articulo.descripcion" |
112 | ></td> | 112 | ></td> |
113 | <td class="col text-right"> | 113 | <td class="col text-right"> |
114 | <input | 114 | <input |
115 | ng-show="articulo.edit" | 115 | ng-show="articulo.edit" |
116 | ng-model="articulo.cantidad" | 116 | ng-model="articulo.cantidad" |
117 | class="form-control" | 117 | class="form-control" |
118 | type="number" | 118 | type="number" |
119 | min="1" | 119 | min="1" |
120 | foca-focus="articulo.edit" | 120 | foca-focus="articulo.edit" |
121 | ng-keypress="editarArticulo($event.keyCode, articulo)" | 121 | ng-keypress="editarArticulo($event.keyCode, articulo)" |
122 | ng-focus="selectFocus($event)" | 122 | ng-focus="selectFocus($event)" |
123 | > | 123 | > |
124 | <i | 124 | <i |
125 | class="selectable" | 125 | class="selectable" |
126 | ng-click="cambioEdit(articulo)" | 126 | ng-click="cambioEdit(articulo)" |
127 | ng-hide="articulo.edit" | 127 | ng-hide="articulo.edit" |
128 | ng-bind="articulo.cantidad"> | 128 | ng-bind="articulo.cantidad"> |
129 | </i> | 129 | </i> |
130 | </td> | 130 | </td> |
131 | <td | 131 | <td |
132 | class="col text-right" | 132 | class="col text-right" |
133 | ng-bind="articulo.precio | currency: '$'" | 133 | ng-bind="articulo.precio | currency: '$'" |
134 | ></td> | 134 | ></td> |
135 | <td | 135 | <td |
136 | class="col text-right" | 136 | class="col text-right" |
137 | ng-bind="(articulo.precio * articulo.cantidad) | currency: '$'"> | 137 | ng-bind="(articulo.precio * articulo.cantidad) | currency: '$'"> |
138 | </td> | 138 | </td> |
139 | <td class="text-center"> | 139 | <td class="text-center"> |
140 | <button | 140 | <button |
141 | class="btn btn-outline-secondary" | 141 | class="btn btn-outline-secondary" |
142 | ng-click="quitarArticulo(key)" | 142 | ng-click="quitarArticulo(key)" |
143 | > | 143 | > |
144 | <i class="fa fa-trash"></i> | 144 | <i class="fa fa-trash"></i> |
145 | </button> | 145 | </button> |
146 | </td> | 146 | </td> |
147 | </tr> | 147 | </tr> |
148 | </tbody> | 148 | </tbody> |
149 | <tfoot> | 149 | <tfoot> |
150 | <tr ng-show="!cargando" class="d-flex"> | 150 | <tr ng-show="!cargando" class="d-flex"> |
151 | <td | 151 | <td |
152 | class="align-middle" | 152 | class="align-middle" |
153 | ng-bind="articulosTabla.length + 1" | 153 | ng-bind="articulosTabla.length + 1" |
154 | ></td> | 154 | ></td> |
155 | <td class="col"> | 155 | <td class="col"> |
156 | <input | 156 | <input |
157 | class="form-control" | 157 | class="form-control" |
158 | ng-model="articuloACargar.sectorCodigo" | 158 | ng-model="articuloACargar.sectorCodigo" |
159 | readonly | 159 | readonly |
160 | > | 160 | > |
161 | </td> | 161 | </td> |
162 | <td class="col-3 tabla-articulo-descripcion"> | 162 | <td class="col-4 tabla-articulo-descripcion"> |
163 | <input | 163 | <input |
164 | class="form-control" | 164 | class="form-control" |
165 | ng-model="articuloACargar.descripcion" | 165 | ng-model="articuloACargar.descripcion" |
166 | readonly | 166 | readonly |
167 | > | 167 | > |
168 | </td> | 168 | </td> |
169 | <td class="col text-right"> | 169 | <td class="col text-right"> |
170 | <input | 170 | <input |
171 | class="form-control" | 171 | class="form-control" |
172 | type="number" | 172 | type="number" |
173 | min="1" | 173 | min="1" |
174 | ng-model="articuloACargar.cantidad" | 174 | ng-model="articuloACargar.cantidad" |
175 | foca-focus="!cargando" | 175 | foca-focus="!cargando" |
176 | esc-key="resetFilter()" | 176 | esc-key="resetFilter()" |
177 | ng-keypress="agregarATabla($event.keyCode)" | 177 | ng-keypress="agregarATabla($event.keyCode)" |
178 | > | 178 | > |
179 | </td> | 179 | </td> |
180 | <td class="col text-right"> | 180 | <td class="col text-right"> |
181 | <input | 181 | <input |
182 | class="form-control" | 182 | class="form-control" |
183 | ng-value="articuloACargar.precio | currency: '$'" | 183 | ng-value="articuloACargar.precio | currency: '$'" |
184 | readonly | 184 | readonly |
185 | > | 185 | > |
186 | </td> | 186 | </td> |
187 | <td class="col text-right"> | 187 | <td class="col text-right"> |
188 | <input | 188 | <input |
189 | class="form-control" | 189 | class="form-control" |
190 | ng-value="getSubTotal() | currency: '$'" | 190 | ng-value="getSubTotal() | currency: '$'" |
191 | readonly | 191 | readonly |
192 | ></td> | 192 | ></td> |
193 | <td class="text-center align-middle"> | 193 | <td class="text-center align-middle"> |
194 | <button | 194 | <button |
195 | class="btn btn-outline-secondary" | 195 | class="btn btn-outline-secondary" |
196 | ng-click="agregarATabla(13)" | 196 | ng-click="agregarATabla(13)" |
197 | > | 197 | > |
198 | <i class="fa fa-save"></i> | 198 | <i class="fa fa-save"></i> |
199 | </button> | 199 | </button> |
200 | </td> | 200 | </td> |
201 | </tr> | 201 | </tr> |
202 | <tr ng-show="cargando" class="d-flex"> | 202 | <tr ng-show="cargando" class="d-flex"> |
203 | <td colspan="7" class="col-12"> | 203 | <td colspan="7" class="col-12"> |
204 | <input | 204 | <input |
205 | placeholder="Seleccione Articulo" | 205 | placeholder="Seleccione Articulo" |
206 | class="form-control form-control-sm" | 206 | class="form-control form-control-sm" |
207 | readonly | 207 | readonly |
208 | ng-click="seleccionarArticulo()" | 208 | ng-click="seleccionarArticulo()" |
209 | /> | 209 | /> |
210 | </td> | 210 | </td> |
211 | </tr> | 211 | </tr> |
212 | <tr class="d-flex"> | 212 | <tr class="d-flex"> |
213 | <td colspan="4"> | 213 | <td colspan="4"> |
214 | <strong>Cantidad Items:</strong> | 214 | <strong>Cantidad Items:</strong> |
215 | <a ng-bind="articulosTabla.length"></a> | 215 | <a ng-bind="articulosTabla.length"></a> |
216 | </td> | 216 | </td> |
217 | <td class="text-right ml-auto table-celda-total"><h3>Total:</h3></td> | 217 | <td class="text-right ml-auto table-celda-total"><h3>Total:</h3></td> |
218 | <td class="table-celda-total text-right" colspan="1"> | 218 | <td class="table-celda-total text-right" colspan="1"> |
219 | <h3>{{getTotal() | currency: '$'}}</h3> | 219 | <h3>{{getTotal() | currency: '$'}}</h3> |
220 | </td> | 220 | </td> |
221 | <td class="text-right"> | 221 | <td class="text-right"> |
222 | <button | 222 | <button |
223 | type="button" | 223 | type="button" |
224 | class="btn btn-default btn-sm" | 224 | class="btn btn-default btn-sm" |
225 | > | 225 | > |
226 | Totales | 226 | Totales |
227 | </button> | 227 | </button> |
228 | </td> | 228 | </td> |
229 | </tr> | 229 | </tr> |
230 | </tfoot> | 230 | </tfoot> |
231 | </table> | 231 | </table> |
232 | </div> | 232 | </div> |
233 | </div> | 233 | </div> |
234 | <div class="col-auto my-2 col-lg-2 botonera-lateral"> | 234 | <div class="col-auto my-2 col-lg-2 botonera-lateral"> |
235 | <div class="row align-items-end"> | 235 | <div class="row align-items-end"> |
236 | <div class="col-12"> | 236 | <div class="col-12"> |
237 | <button | 237 | <button |
238 | ng-click="crearNotaPedido()" | 238 | ng-click="crearNotaPedido()" |
239 | type="submit" | 239 | type="submit" |
240 | title="Crear nota pedido" | 240 | title="Crear nota pedido" |
241 | class="btn btn-default btn-block mb-2"> | 241 | class="btn btn-default btn-block mb-2"> |
242 | Guardar | 242 | Guardar |
243 | </button> | 243 | </button> |
244 | <button | 244 | <button |
245 | ng-click="salir()" | 245 | ng-click="salir()" |
246 | type="button" | 246 | type="button" |
247 | title="Salir" | 247 | title="Salir" |
248 | class="btn btn-default btn-block"> | 248 | class="btn btn-default btn-block"> |
249 | Salir | 249 | Salir |
250 | </button> | 250 | </button> |
251 | </div> | 251 | </div> |
252 | </div> | 252 | </div> |
253 | </div> | 253 | </div> |
254 | </div> | 254 | </div> |
255 | </div> | 255 | </div> |
256 | 256 |