Commit 37da41698d807a697370fb636ac4b0097e8b2a15
1 parent
1194dd7f40
Exists in
master
cambios para mobile y mejora en tabla de articulos
Showing
2 changed files
with
57 additions
and
36 deletions
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 | precioCondicion: $scope.notaPedido.precioCondicion, | 104 | precioCondicion: $scope.notaPedido.precioCondicion, |
104 | bomba: $scope.notaPedido.bomba, | 105 | bomba: $scope.notaPedido.bomba, |
105 | flete: $scope.notaPedido.flete, | 106 | flete: $scope.notaPedido.flete, |
106 | total: $scope.getTotal() | 107 | total: $scope.getTotal() |
107 | }; | 108 | }; |
108 | crearNotaPedidoService.crearNotaPedido(notaPedido).then( | 109 | crearNotaPedidoService.crearNotaPedido(notaPedido).then( |
109 | function(data) { | 110 | function(data) { |
110 | focaModalService.alert('Nota pedido creada'); | 111 | focaModalService.alert('Nota pedido creada'); |
111 | if($scope.notaPedido.flete === 1) { | 112 | if($scope.notaPedido.flete === 1) { |
112 | var flete = { | 113 | var flete = { |
113 | idNotaPedido: data.data.id, | 114 | idNotaPedido: data.data.id, |
114 | idTransportista: $scope.notaPedido.fleteId, | 115 | idTransportista: $scope.notaPedido.fleteId, |
115 | idChofer: $scope.notaPedido.chofer.id, | 116 | idChofer: $scope.notaPedido.chofer.id, |
116 | idVehiculo: $scope.notaPedido.vehiculo.id, | 117 | idVehiculo: $scope.notaPedido.vehiculo.id, |
117 | kilometros: $scope.notaPedido.kilometros, | 118 | kilometros: $scope.notaPedido.kilometros, |
118 | costoKilometro: $scope.notaPedido.costoUnitarioKmFlete | 119 | costoKilometro: $scope.notaPedido.costoUnitarioKmFlete |
119 | }; | 120 | }; |
120 | crearNotaPedidoService.crearFlete(flete); | 121 | crearNotaPedidoService.crearFlete(flete); |
121 | } | 122 | } |
122 | var articulosNotaPedido = $scope.articulosTabla; | 123 | var articulosNotaPedido = $scope.articulosTabla; |
123 | for(var i = 0; i < articulosNotaPedido.length; i++) { | 124 | for(var i = 0; i < articulosNotaPedido.length; i++) { |
124 | delete articulosNotaPedido[i].edit; | 125 | delete articulosNotaPedido[i].edit; |
125 | articulosNotaPedido[i].idNotaPedido = data.data.id; | 126 | articulosNotaPedido[i].idNotaPedido = data.data.id; |
126 | crearNotaPedidoService | 127 | crearNotaPedidoService |
127 | .crearArticulosParaNotaPedido(articulosNotaPedido[i]); | 128 | .crearArticulosParaNotaPedido(articulosNotaPedido[i]); |
128 | } | 129 | } |
129 | $scope.limpiarPantalla(); | 130 | $scope.limpiarPantalla(); |
130 | } | 131 | } |
131 | ); | 132 | ); |
132 | }; | 133 | }; |
133 | 134 | ||
134 | $scope.seleccionarArticulo = function() { | 135 | $scope.seleccionarArticulo = function() { |
135 | if (idLista === undefined) { | 136 | if (idLista === undefined) { |
136 | focaModalService.alert( | 137 | focaModalService.alert( |
137 | 'Primero seleccione una lista de precio y condicion'); | 138 | 'Primero seleccione una lista de precio y condicion'); |
138 | return; | 139 | return; |
139 | } | 140 | } |
140 | var modalInstance = $uibModal.open( | 141 | var modalInstance = $uibModal.open( |
141 | { | 142 | { |
142 | ariaLabelledBy: 'Busqueda de Productos', | 143 | ariaLabelledBy: 'Busqueda de Productos', |
143 | templateUrl: 'modal-busqueda-productos.html', | 144 | templateUrl: 'modal-busqueda-productos.html', |
144 | controller: 'modalBusquedaProductosCtrl', | 145 | controller: 'modalBusquedaProductosCtrl', |
145 | resolve: { idLista: function() { return idLista; } }, | 146 | resolve: { idLista: function() { return idLista; } }, |
146 | size: 'lg' | 147 | size: 'lg' |
147 | } | 148 | } |
148 | ); | 149 | ); |
149 | modalInstance.result.then( | 150 | modalInstance.result.then( |
150 | function(producto) { | 151 | function(producto) { |
151 | var newArt = | 152 | var newArt = |
152 | { | 153 | { |
153 | id: 0, | 154 | id: 0, |
154 | codigo: producto.codigo, | 155 | codigo: producto.codigo, |
155 | sector: producto.sector, | 156 | sector: producto.sector, |
156 | sectorCodigo: producto.sector + '-' + producto.codigo, | 157 | sectorCodigo: producto.sector + '-' + producto.codigo, |
157 | descripcion: producto.descripcion, | 158 | descripcion: producto.descripcion, |
158 | item: $scope.articulosTabla.length + 1, | 159 | item: $scope.articulosTabla.length + 1, |
159 | nombre: producto.descripcion, | 160 | nombre: producto.descripcion, |
160 | precio: producto.precio.toFixed(2), | 161 | precio: producto.precio.toFixed(2), |
161 | costoUnitario: producto.costo, | 162 | costoUnitario: producto.costo, |
162 | edit: false | 163 | edit: false |
163 | }; | 164 | }; |
164 | $scope.articuloACargar = newArt; | 165 | $scope.articuloACargar = newArt; |
165 | $scope.cargando = false; | 166 | $scope.cargando = false; |
166 | }, function() { | 167 | }, function() { |
167 | // funcion ejecutada cuando se cancela el modal | 168 | // funcion ejecutada cuando se cancela el modal |
168 | } | 169 | } |
169 | ); | 170 | ); |
170 | }; | 171 | }; |
171 | 172 | ||
172 | $scope.seleccionarVendedor = function() { | 173 | $scope.seleccionarVendedor = function() { |
173 | var modalInstance = $uibModal.open( | 174 | var modalInstance = $uibModal.open( |
174 | { | 175 | { |
175 | ariaLabelledBy: 'Busqueda de Vendedores', | 176 | ariaLabelledBy: 'Busqueda de Vendedores', |
176 | templateUrl: 'modal-vendedores.html', | 177 | templateUrl: 'modal-vendedores.html', |
177 | controller: 'modalVendedoresCtrl', | 178 | controller: 'modalVendedoresCtrl', |
178 | size: 'lg' | 179 | size: 'lg' |
179 | } | 180 | } |
180 | ); | 181 | ); |
181 | modalInstance.result.then( | 182 | modalInstance.result.then( |
182 | function(vendedor) { | 183 | function(vendedor) { |
183 | addCabecera('Vendedor:', vendedor.NomVen); | 184 | addCabecera('Vendedor:', vendedor.NomVen); |
184 | $scope.notaPedido.vendedor.nombre = vendedor.NomVen; | 185 | $scope.notaPedido.vendedor.nombre = vendedor.NomVen; |
185 | }, function() { | 186 | }, function() { |
186 | 187 | ||
187 | } | 188 | } |
188 | ); | 189 | ); |
189 | }; | 190 | }; |
190 | 191 | ||
191 | $scope.seleccionarProveedor = function() { | 192 | $scope.seleccionarProveedor = function() { |
192 | var modalInstance = $uibModal.open( | 193 | var modalInstance = $uibModal.open( |
193 | { | 194 | { |
194 | ariaLabelledBy: 'Busqueda de Proveedor', | 195 | ariaLabelledBy: 'Busqueda de Proveedor', |
195 | templateUrl: 'modal-proveedor.html', | 196 | templateUrl: 'modal-proveedor.html', |
196 | controller: 'focaModalProveedorCtrl', | 197 | controller: 'focaModalProveedorCtrl', |
197 | size: 'lg' | 198 | size: 'lg' |
198 | } | 199 | } |
199 | ); | 200 | ); |
200 | modalInstance.result.then( | 201 | modalInstance.result.then( |
201 | function(proveedor) { | 202 | function(proveedor) { |
202 | $scope.notaPedido.proveedor = proveedor.NOM; | 203 | $scope.notaPedido.proveedor = proveedor.NOM; |
203 | addCabecera('Proveedor:', proveedor.NOM); | 204 | addCabecera('Proveedor:', proveedor.NOM); |
204 | }, function() { | 205 | }, function() { |
205 | 206 | ||
206 | } | 207 | } |
207 | ); | 208 | ); |
208 | }; | 209 | }; |
209 | 210 | ||
210 | $scope.seleccionarCliente = function() { | 211 | $scope.seleccionarCliente = function() { |
211 | var modalInstance = $uibModal.open( | 212 | var modalInstance = $uibModal.open( |
212 | { | 213 | { |
213 | ariaLabelledBy: 'Busqueda de Cliente', | 214 | ariaLabelledBy: 'Busqueda de Cliente', |
214 | templateUrl: 'foca-busqueda-cliente-modal.html', | 215 | templateUrl: 'foca-busqueda-cliente-modal.html', |
215 | controller: 'focaBusquedaClienteModalController', | 216 | controller: 'focaBusquedaClienteModalController', |
216 | size: 'lg' | 217 | size: 'lg' |
217 | } | 218 | } |
218 | ); | 219 | ); |
219 | modalInstance.result.then( | 220 | modalInstance.result.then( |
220 | function(cliente) { | 221 | function(cliente) { |
221 | $scope.notaPedido.cliente.nombre = cliente.nom; | 222 | $scope.notaPedido.cliente.nombre = cliente.nom; |
222 | $scope.notaPedido.cliente.id = cliente.cod; | 223 | $scope.notaPedido.cliente.id = cliente.cod; |
223 | crearNotaPedidoService.getDomiciliosByIdCliente(cliente.cod).then( | 224 | crearNotaPedidoService.getDomiciliosByIdCliente(cliente.cod).then( |
224 | function(data) { | 225 | function(data) { |
225 | if(data.data.length === 0){ | 226 | if(data.data.length === 0){ |
226 | focaModalService | 227 | focaModalService |
227 | .alert('El cliente no tienen domicilios de entrega') | 228 | .alert('El cliente no tienen domicilios de entrega') |
228 | .then( | 229 | .then( |
229 | function() { | 230 | function() { |
230 | $scope.seleccionarCliente(); | 231 | $scope.seleccionarCliente(); |
231 | $scope.notaPedido.cliente = {nombre: ''}; | 232 | $scope.notaPedido.cliente = {nombre: ''}; |
232 | } | 233 | } |
233 | ); | 234 | ); |
234 | return; | 235 | return; |
235 | } | 236 | } |
236 | var modalInstanceDomicilio = $uibModal.open( | 237 | var modalInstanceDomicilio = $uibModal.open( |
237 | { | 238 | { |
238 | ariaLabelledBy: 'Busqueda de Domicilios', | 239 | ariaLabelledBy: 'Busqueda de Domicilios', |
239 | templateUrl: 'modal-domicilio.html', | 240 | templateUrl: 'modal-domicilio.html', |
240 | controller: 'focaModalDomicilioController', | 241 | controller: 'focaModalDomicilioController', |
241 | resolve: { idCliente: function() { return cliente.cod; }}, | 242 | resolve: { idCliente: function() { return cliente.cod; }}, |
242 | size: 'lg', | 243 | size: 'lg', |
243 | backdrop: 'static', | 244 | backdrop: 'static', |
244 | } | 245 | } |
245 | ); | 246 | ); |
246 | modalInstanceDomicilio.result.then( | 247 | modalInstanceDomicilio.result.then( |
247 | function(domicilio) { | 248 | function(domicilio) { |
248 | focaModalService.alert('Domicilio elegido' + domicilio.dom); | 249 | focaModalService.alert('Domicilio elegido' + domicilio.dom); |
249 | }, function() { | 250 | }, function() { |
250 | $scope.notaPedido.cliente.nombre = ''; | 251 | $scope.notaPedido.cliente.nombre = ''; |
251 | $scope.notaPedido.cliente.id = ''; | 252 | $scope.notaPedido.cliente.id = ''; |
252 | removeCabecera('Cliente:'); | 253 | removeCabecera('Cliente:'); |
253 | $scope.seleccionarCliente(); | 254 | $scope.seleccionarCliente(); |
254 | return; | 255 | return; |
255 | } | 256 | } |
256 | ); | 257 | ); |
257 | } | 258 | } |
258 | ); | 259 | ); |
259 | addCabecera('Cliente:', cliente.nom); | 260 | addCabecera('Cliente:', cliente.nom); |
260 | }, function() { | 261 | }, function() { |
261 | 262 | ||
262 | } | 263 | } |
263 | ); | 264 | ); |
264 | }; | 265 | }; |
265 | 266 | ||
266 | $scope.mostrarFichaCliente = function() { | 267 | $scope.mostrarFichaCliente = function() { |
267 | $uibModal.open( | 268 | $uibModal.open( |
268 | { | 269 | { |
269 | ariaLabelledBy: 'Datos del Cliente', | 270 | ariaLabelledBy: 'Datos del Cliente', |
270 | templateUrl: 'foca-crear-nota-pedido-ficha-cliente.html', | 271 | templateUrl: 'foca-crear-nota-pedido-ficha-cliente.html', |
271 | controller: 'focaCrearNotaPedidoFichaClienteController', | 272 | controller: 'focaCrearNotaPedidoFichaClienteController', |
272 | size: 'lg' | 273 | size: 'lg' |
273 | } | 274 | } |
274 | ); | 275 | ); |
275 | }; | 276 | }; |
276 | 277 | ||
277 | $scope.getTotal = function() { | 278 | $scope.getTotal = function() { |
278 | var total = 0; | 279 | var total = 0; |
279 | var arrayTempArticulos = $scope.articulosTabla; | 280 | var arrayTempArticulos = $scope.articulosTabla; |
280 | for (var i = 0; i < arrayTempArticulos.length; i++) { | 281 | for (var i = 0; i < arrayTempArticulos.length; i++) { |
281 | total += arrayTempArticulos[i].precio * arrayTempArticulos[i].cantidad; | 282 | total += arrayTempArticulos[i].precio * arrayTempArticulos[i].cantidad; |
282 | } | 283 | } |
283 | return total.toFixed(2); | 284 | return total.toFixed(2); |
284 | }; | 285 | }; |
285 | 286 | ||
286 | $scope.getSubTotal = function() { | 287 | $scope.getSubTotal = function() { |
287 | if($scope.articuloACargar) { | 288 | if($scope.articuloACargar) { |
288 | return $scope.articuloACargar.precio * $scope.articuloACargar.cantidad; | 289 | return $scope.articuloACargar.precio * $scope.articuloACargar.cantidad; |
289 | } | 290 | } |
290 | }; | 291 | }; |
291 | 292 | ||
292 | $scope.abrirModalListaPrecio = function() { | 293 | $scope.abrirModalListaPrecio = function() { |
293 | var modalInstance = $uibModal.open( | 294 | var modalInstance = $uibModal.open( |
294 | { | 295 | { |
295 | ariaLabelledBy: 'Busqueda de Precio Condición', | 296 | ariaLabelledBy: 'Busqueda de Precio Condición', |
296 | templateUrl: 'modal-precio-condicion.html', | 297 | templateUrl: 'modal-precio-condicion.html', |
297 | controller: 'focaModalPrecioCondicionController', | 298 | controller: 'focaModalPrecioCondicionController', |
298 | size: 'lg' | 299 | size: 'lg' |
299 | } | 300 | } |
300 | ); | 301 | ); |
301 | modalInstance.result.then( | 302 | modalInstance.result.then( |
302 | function(precioCondicion) { | 303 | function(precioCondicion) { |
303 | $scope.notaPedido.precioCondicion = precioCondicion.nombre; | 304 | $scope.notaPedido.precioCondicion = precioCondicion.nombre; |
304 | idLista = precioCondicion.idListaPrecio; | 305 | idLista = precioCondicion.idListaPrecio; |
305 | $scope.articulosTabla = []; | 306 | $scope.articulosTabla = []; |
306 | 307 | ||
307 | addCabecera('Precios y condiciones:', precioCondicion.nombre); | 308 | addCabecera('Precios y condiciones:', precioCondicion.nombre); |
308 | }, function() { | 309 | }, function() { |
309 | 310 | ||
310 | } | 311 | } |
311 | ); | 312 | ); |
312 | }; | 313 | }; |
313 | 314 | ||
314 | $scope.abrirModalFlete = function() { | 315 | $scope.abrirModalFlete = function() { |
315 | var modalInstance = $uibModal.open( | 316 | var modalInstance = $uibModal.open( |
316 | { | 317 | { |
317 | ariaLabelledBy: 'Busqueda de Flete', | 318 | ariaLabelledBy: 'Busqueda de Flete', |
318 | templateUrl: 'modal-flete.html', | 319 | templateUrl: 'modal-flete.html', |
319 | controller: 'focaModalFleteController', | 320 | controller: 'focaModalFleteController', |
320 | size: 'lg', | 321 | size: 'lg', |
321 | resolve: { | 322 | resolve: { |
322 | parametrosFlete: | 323 | parametrosFlete: |
323 | function() { | 324 | function() { |
324 | return { | 325 | return { |
325 | flete: $scope.notaPedido.flete, | 326 | flete: $scope.notaPedido.flete, |
326 | bomba: $scope.notaPedido.bomba, | 327 | bomba: $scope.notaPedido.bomba, |
327 | kilometros: $scope.notaPedido.kilometros | 328 | kilometros: $scope.notaPedido.kilometros |
328 | }; | 329 | }; |
329 | } | 330 | } |
330 | } | 331 | } |
331 | } | 332 | } |
332 | ); | 333 | ); |
333 | modalInstance.result.then( | 334 | modalInstance.result.then( |
334 | function(datos) { | 335 | function(datos) { |
335 | $scope.notaPedido.flete = datos.flete; | 336 | $scope.notaPedido.flete = datos.flete; |
336 | $scope.notaPedido.bomba = datos.bomba; | 337 | $scope.notaPedido.bomba = datos.bomba; |
337 | $scope.notaPedido.kilometros = datos.kilometros; | 338 | $scope.notaPedido.kilometros = datos.kilometros; |
338 | 339 | ||
339 | addCabecera('Flete:', datos.flete); | 340 | addCabecera('Flete:', datos.flete); |
340 | if(datos.flete === 'si') { | 341 | if(datos.flete === 'si') { |
341 | addCabecera('Bomba:', datos.bomba); | 342 | addCabecera('Bomba:', datos.bomba); |
342 | addCabecera('Kilometros:', datos.kilometros); | 343 | addCabecera('Kilometros:', datos.kilometros); |
343 | } else { | 344 | } else { |
344 | removeCabecera('Bomba:'); | 345 | removeCabecera('Bomba:'); |
345 | removeCabecera('Kilometros:'); | 346 | removeCabecera('Kilometros:'); |
346 | } | 347 | } |
347 | }, function() { | 348 | }, function() { |
348 | 349 | ||
349 | } | 350 | } |
350 | ); | 351 | ); |
351 | }; | 352 | }; |
352 | 353 | ||
353 | $scope.abrirModalMoneda = function() { | 354 | $scope.abrirModalMoneda = function() { |
354 | var modalInstance = $uibModal.open( | 355 | var modalInstance = $uibModal.open( |
355 | { | 356 | { |
356 | ariaLabelledBy: 'Busqueda de Moneda', | 357 | ariaLabelledBy: 'Busqueda de Moneda', |
357 | templateUrl: 'modal-moneda.html', | 358 | templateUrl: 'modal-moneda.html', |
358 | controller: 'focaModalMonedaController', | 359 | controller: 'focaModalMonedaController', |
359 | size: 'lg' | 360 | size: 'lg' |
360 | } | 361 | } |
361 | ); | 362 | ); |
362 | modalInstance.result.then( | 363 | modalInstance.result.then( |
363 | function(moneda) { | 364 | function(moneda) { |
364 | $scope.notaPedido.moneda = { | 365 | $scope.notaPedido.moneda = { |
365 | id: moneda.ID, | 366 | id: moneda.ID, |
366 | detalle: moneda.DETALLE, | 367 | detalle: moneda.DETALLE, |
367 | simbolo: moneda.SIMBOLO | 368 | simbolo: moneda.SIMBOLO |
368 | }; | 369 | }; |
369 | 370 | ||
370 | addCabecera('Moneda:', moneda.DETALLE); | 371 | addCabecera('Moneda:', moneda.DETALLE); |
371 | }, function() { | 372 | }, function() { |
372 | 373 | ||
373 | } | 374 | } |
374 | ); | 375 | ); |
375 | }; | 376 | }; |
376 | 377 | ||
377 | $scope.agregarATabla = function(key) { | 378 | $scope.agregarATabla = function(key) { |
378 | if(key === 13) { | 379 | if(key === 13) { |
379 | if($scope.articuloACargar.cantidad === undefined || | 380 | if($scope.articuloACargar.cantidad === undefined || |
380 | $scope.articuloACargar.cantidad === 0 || | 381 | $scope.articuloACargar.cantidad === 0 || |
381 | $scope.articuloACargar.cantidad === null ){ | 382 | $scope.articuloACargar.cantidad === null ){ |
382 | focaModalService.alert('El valor debe ser al menos 1'); | 383 | focaModalService.alert('El valor debe ser al menos 1'); |
383 | return; | 384 | return; |
384 | } | 385 | } |
385 | delete $scope.articuloACargar.sectorCodigo; | 386 | delete $scope.articuloACargar.sectorCodigo; |
386 | $scope.articulosTabla.push($scope.articuloACargar); | 387 | $scope.articulosTabla.push($scope.articuloACargar); |
387 | $scope.cargando = true; | 388 | $scope.cargando = true; |
388 | } | 389 | } |
389 | }; | 390 | }; |
390 | 391 | ||
391 | $scope.quitarArticulo = function(key) { | 392 | $scope.quitarArticulo = function(key) { |
392 | $scope.articulosTabla.splice(key, 1); | 393 | $scope.articulosTabla.splice(key, 1); |
393 | }; | 394 | }; |
394 | 395 | ||
395 | $scope.editarArticulo = function(key, articulo) { | 396 | $scope.editarArticulo = function(key, articulo) { |
396 | if(key === 13) { | 397 | if(key === 13) { |
397 | if(articulo.cantidad === null || articulo.cantidad === 0 || | 398 | if(articulo.cantidad === null || articulo.cantidad === 0 || |
398 | articulo.cantidad === undefined){ | 399 | articulo.cantidad === undefined){ |
399 | focaModalService.alert('El valor debe ser al menos 1'); | 400 | focaModalService.alert('El valor debe ser al menos 1'); |
400 | return; | 401 | return; |
401 | } | 402 | } |
402 | articulo.edit = false; | 403 | articulo.edit = false; |
403 | } | 404 | } |
404 | }; | 405 | }; |
405 | 406 | ||
406 | $scope.cambioEdit = function(articulo) { | 407 | $scope.cambioEdit = function(articulo) { |
407 | articulo.edit = true; | 408 | articulo.edit = true; |
408 | }; | 409 | }; |
409 | 410 | ||
410 | $scope.limpiarFlete = function() { | 411 | $scope.limpiarFlete = function() { |
411 | $scope.notaPedido.fleteNombre = ''; | 412 | $scope.notaPedido.fleteNombre = ''; |
412 | $scope.notaPedido.chofer = ''; | 413 | $scope.notaPedido.chofer = ''; |
413 | $scope.notaPedido.vehiculo = ''; | 414 | $scope.notaPedido.vehiculo = ''; |
414 | $scope.notaPedido.kilometros = ''; | 415 | $scope.notaPedido.kilometros = ''; |
415 | $scope.notaPedido.costoUnitarioKmFlete = ''; | 416 | $scope.notaPedido.costoUnitarioKmFlete = ''; |
416 | $scope.choferes = ''; | 417 | $scope.choferes = ''; |
417 | $scope.vehiculos = ''; | 418 | $scope.vehiculos = ''; |
418 | }; | 419 | }; |
419 | 420 | ||
420 | $scope.limpiarPantalla = function() { | 421 | $scope.limpiarPantalla = function() { |
421 | $scope.limpiarFlete(); | 422 | $scope.limpiarFlete(); |
422 | $scope.notaPedido.flete = '0'; | 423 | $scope.notaPedido.flete = '0'; |
423 | $scope.notaPedido.bomba = '0'; | 424 | $scope.notaPedido.bomba = '0'; |
424 | $scope.notaPedido.precioCondicion = ''; | 425 | $scope.notaPedido.precioCondicion = ''; |
425 | $scope.articulosTabla = []; | 426 | $scope.articulosTabla = []; |
426 | $scope.notaPedido.vendedor.nombre = ''; | 427 | $scope.notaPedido.vendedor.nombre = ''; |
427 | $scope.notaPedido.cliente = {nombre: ''}; | 428 | $scope.notaPedido.cliente = {nombre: ''}; |
428 | $scope.notaPedido.domicilio = {dom: ''}; | 429 | $scope.notaPedido.domicilio = {dom: ''}; |
429 | $scope.domiciliosCliente = []; | 430 | $scope.domiciliosCliente = []; |
430 | }; | 431 | }; |
431 | 432 | ||
432 | $scope.resetFilter = function() { | 433 | $scope.resetFilter = function() { |
433 | $scope.articuloACargar = {}; | 434 | $scope.articuloACargar = {}; |
434 | $scope.cargando = true; | 435 | $scope.cargando = true; |
435 | }; | 436 | }; |
436 | 437 | ||
437 | $scope.selectFocus = function($event) { | 438 | $scope.selectFocus = function($event) { |
438 | $event.target.select(); | 439 | $event.target.select(); |
439 | }; | 440 | }; |
440 | 441 | ||
441 | $scope.salir = function() { | 442 | $scope.salir = function() { |
442 | $location.path('/'); | 443 | $location.path('/'); |
443 | }; | 444 | }; |
444 | 445 | ||
445 | function addCabecera(label, valor) { | 446 | function addCabecera(label, valor) { |
446 | var propiedad = $filter('filter')($scope.cabecera, {label: label}); | 447 | var propiedad = $filter('filter')($scope.cabecera, {label: label}); |
447 | if(propiedad.length === 1) { | 448 | if(propiedad.length === 1) { |
448 | propiedad[0].valor = valor; | 449 | propiedad[0].valor = valor; |
449 | } else { | 450 | } else { |
450 | $scope.cabecera.push({label: label, valor: valor}); | 451 | $scope.cabecera.push({label: label, valor: valor}); |
451 | } | 452 | } |
452 | } | 453 | } |
453 | 454 | ||
454 | function removeCabecera(label) { | 455 | function removeCabecera(label) { |
455 | var propiedad = $filter('filter')($scope.cabecera, {label: label}); | 456 | var propiedad = $filter('filter')($scope.cabecera, {label: label}); |
456 | if(propiedad.length === 1){ | 457 | if(propiedad.length === 1){ |
457 | $scope.cabecera.splice($scope.cabecera.indexOf(propiedad[0]), 1); | 458 | $scope.cabecera.splice($scope.cabecera.indexOf(propiedad[0]), 1); |
458 | } | 459 | } |
459 | } | 460 | } |
460 | } | 461 | } |
461 | ] | 462 | ] |
462 | ) | 463 | ) |
463 | .controller('notaPedidoListaCtrl', [ | 464 | .controller('notaPedidoListaCtrl', [ |
464 | '$scope', | 465 | '$scope', |
465 | 'crearNotaPedidoService', | 466 | 'crearNotaPedidoService', |
466 | '$location', | 467 | '$location', |
467 | function($scope, crearNotaPedidoService, $location) { | 468 | function($scope, crearNotaPedidoService, $location) { |
468 | crearNotaPedidoService.obtenerNotaPedido().then(function(datos) { | 469 | crearNotaPedidoService.obtenerNotaPedido().then(function(datos) { |
469 | $scope.notaPedidos = datos.data; | 470 | $scope.notaPedidos = datos.data; |
470 | }); | 471 | }); |
471 | $scope.editar = function(notaPedido) { | 472 | $scope.editar = function(notaPedido) { |
472 | crearNotaPedidoService.setNotaPedido(notaPedido); | 473 | crearNotaPedidoService.setNotaPedido(notaPedido); |
473 | $location.path('/venta-nota-pedido/abm/'); | 474 | $location.path('/venta-nota-pedido/abm/'); |
474 | }; | 475 | }; |
475 | $scope.crearPedido = function() { | 476 | $scope.crearPedido = function() { |
476 | crearNotaPedidoService.clearNotaPedido(); | 477 | crearNotaPedidoService.clearNotaPedido(); |
477 | $location.path('/venta-nota-pedido/abm/'); | 478 | $location.path('/venta-nota-pedido/abm/'); |
478 | }; | 479 | }; |
479 | } | 480 | } |
480 | ]) | 481 | ]) |
481 | .controller('focaCrearNotaPedidoFichaClienteController', [ | 482 | .controller('focaCrearNotaPedidoFichaClienteController', [ |
482 | '$scope', | 483 | '$scope', |
483 | 'crearNotaPedidoService', | 484 | 'crearNotaPedidoService', |
484 | '$location', | 485 | '$location', |
485 | function($scope, crearNotaPedidoService, $location) { | 486 | function($scope, crearNotaPedidoService, $location) { |
486 | crearNotaPedidoService.obtenerNotaPedido().then(function(datos) { | 487 | crearNotaPedidoService.obtenerNotaPedido().then(function(datos) { |
487 | $scope.notaPedidos = datos.data; | 488 | $scope.notaPedidos = datos.data; |
488 | }); | 489 | }); |
489 | $scope.editar = function(notaPedido) { | 490 | $scope.editar = function(notaPedido) { |
490 | crearNotaPedidoService.setNotaPedido(notaPedido); | 491 | crearNotaPedidoService.setNotaPedido(notaPedido); |
491 | $location.path('/venta-nota-pedido/abm/'); | 492 | $location.path('/venta-nota-pedido/abm/'); |
492 | }; | 493 | }; |
493 | $scope.crearPedido = function() { | 494 | $scope.crearPedido = function() { |
494 | crearNotaPedidoService.clearNotaPedido(); | 495 | crearNotaPedidoService.clearNotaPedido(); |
495 | $location.path('/venta-nota-pedido/abm/'); | 496 | $location.path('/venta-nota-pedido/abm/'); |
496 | }; | 497 | }; |
497 | } | 498 | } |
498 | ]); | 499 | ]); |
499 | 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-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 |