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