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