forked from nathalie/pedi2
		
	Elegir pedido existente
This commit is contained in:
		
							parent
							
								
									d17bc70c45
								
							
						
					
					
						commit
						39cc35341f
					
				
					 2 changed files with 14 additions and 11 deletions
				
			
		
							
								
								
									
										17
									
								
								public/js/subpedidos-create.js
									
										
									
									
										vendored
									
									
								
							
							
						
						
									
										17
									
								
								public/js/subpedidos-create.js
									
										
									
									
										vendored
									
									
								
							|  | @ -10,7 +10,7 @@ Vue.component('subpedido-select', { | |||
|       return this.subpedidosExistentes.map(a => a.nombre.toLowerCase()) | ||||
|     }, | ||||
|     botonCrearDesabilitado : function() { | ||||
|       return this.subpedido == null || this.nombresDeSubpedidos.includes(this.subpedido.toLowerCase()) | ||||
|       return !this.subpedido || this.nombresDeSubpedidos.includes(this.subpedido.toLowerCase()) | ||||
|     } | ||||
|   }, | ||||
| 	props: ["gdcid"], | ||||
|  | @ -19,6 +19,10 @@ Vue.component('subpedido-select', { | |||
|   	}, | ||||
| 	methods: { | ||||
|   		onType() { | ||||
|         if (!this.subpedido){ | ||||
|           this.subpedidosExistentes = []; | ||||
|           return; | ||||
|         } | ||||
| 	    	axios.get("/api/subpedidos", { | ||||
|           params: { | ||||
|             nombre: this.subpedido, | ||||
|  | @ -33,17 +37,16 @@ Vue.component('subpedido-select', { | |||
|   				nombre: this.subpedido, | ||||
|   				grupo_de_compra_id: this.gdcid | ||||
|   			}).then(response => { | ||||
| 
 | ||||
|           //se creo el subpedido, guardamos el subpedido en sesion
 | ||||
|           this.guardarSubpedidoEnSesion(response.data); | ||||
|   			}); | ||||
|   		}, | ||||
|       guardarSubpedidoEnSesion(subpedido) { | ||||
|         axios.post("/subpedidos/guardar_sesion", { | ||||
|   					subpedido: response.data | ||||
|           subpedido: subpedido | ||||
|         }).then(response => { | ||||
|           window.location.href = 'productos'; | ||||
|         }); | ||||
|   			}); | ||||
|   		}, | ||||
|       elegirExistente(){ | ||||
|         return; | ||||
|       } | ||||
|   	} | ||||
| }); | ||||
|  | @ -18,7 +18,7 @@ | |||
| 			        <div class="control"> | ||||
| 		        		<input class="input" @input="onType" v-model="subpedido"></input> | ||||
| 					</div> | ||||
| 					<p class="help">Intentá que sea claro como para que tus compas del barrio te identifiquen.</p> | ||||
| 					<p class="help">Debe ser claro para que tus compas del barrio te identifiquen.</p> | ||||
| 				</div> | ||||
| 			</div> | ||||
| 	  		<div class="column is-one-third buttons"> | ||||
|  | @ -31,7 +31,7 @@ | |||
|   				<div class="columns is-mobile" v-for="(subpedidoExistente, index) in subpedidosExistentes" :class="{'has-background-grey-lighter': index % 2}"> | ||||
|   					<div class="column is-half-mobile is-two-thirds-desktop is-two-thirds-tablet"><p style="padding-top: calc(.5em - 1px); margin-bottom: .5rem" v-text="subpedidoExistente.nombre"></p></div> | ||||
| 					<div class="buttons column is-half-mobile is-one-third-desktop is-one-third-tablet"> | ||||
| 					  	<button class="button is-danger" @click="elegirExistente">Modificar pedido existente</button> | ||||
| 					  	<button class="button is-danger" @click="guardarSubpedidoEnSesion(subpedidoExistente)">Continuar pedido</button> | ||||
|   					</div> | ||||
|   				</div> | ||||
| 			</div>		 | ||||
|  |  | |||
		Loading…
	
	Add table
		
		Reference in a new issue
	
	 nat
						nat